<div class="assignments view">
<h2><?php  __('Assignment');?>: <?php echo $assignment['Assignment']['title']; ?></h2>

<h3><?php  __('Instruction');?></h3>
	<p><?php echo $assignment['Assignment']['description']; ?></p><br />
	
	<dl><?php $i = 0; $class = ' class="altrow"';?>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $assignment['Assignment']['id']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Project'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $this->Html->link($assignment['Project']['title'], '/admin/projects/view/'.$assignment['Project']['id']); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('User'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $this->Html->link($assignment['User']['name'], array('controller' => 'users', 'action' => 'view', $assignment['User']['id'])); ?>
			&nbsp;
		</dd>
		
		
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $assignment['Assignment']['created']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Modified'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $assignment['Assignment']['modified']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Status'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $assignment['Assignment']['status']; ?>
			&nbsp;
		</dd>
	</dl>
	
	
	<?php
	
	
	
	if (isset($assignment['AssignmentCode']) && count($assignment['AssignmentCode'])) {
		$last_id = count($assignment['AssignmentCode'])-1;
?>
		<br /><br />	
		<h3>Last submitted asignment code</h3>
		<dl><?php $i = 0; $class = ' class="altrow"';?>
		
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Comitted By'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
				<?php echo $assignment['User']['name'] ?>
				&nbsp;
		</dd>
		
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Submitted Time'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
				<?php echo $assignment['AssignmentCode'][$last_id]['submitted_time'] ?>
				&nbsp;
		</dd>
		</dl>
		
		<br />
		<p style="border:1px #ccc dotted;"><?php echo nl2br(htmlentities($assignment['AssignmentCode'][$last_id]['code'])) ?></p>
		<?php if ($assignment['Assignment']['status'] == 'under_review') { ?>
		<br />
		<h4><b>This is waiting for your review. Once review done, you can Approve/Reject</b></h4>
		<form action="<?php echo $this->base; ?>/admin/assignments/view/<?php echo $assignment['Assignment']['id']; ?>" id="ProjectViewForm1" method="post" accept-charset="utf-8">
				<input type="hidden" name="_method" value="POST" />
				
				<input type="hidden" name="status" value="approved" />
				<input type="hidden" name="user_id" value="<?php echo $assignment['Assignment']['user_id']; ?>" />
				<div class="submit"><input type="submit" value="Approve!" /></div>
		</form>			
		<form action="<?php echo $this->base; ?>/admin/assignments/view/<?php echo $assignment['Assignment']['id']; ?>" id="ProjectViewForm2" method="post" accept-charset="utf-8">
			<input type="hidden" name="_method" value="POST" />
			
			<input type="hidden" name="status" value="revision" />
			<div class="submit"><input type="submit" value="Reject!" /></div>
		</form>					
			
<?php	
		}
	}
	
?>
	
</div>
